<div class="row-fluid">
    <div class="span12">
        <div class="grid simple">
            <div class="grid-title no-border">
                <h4>Объединение</h4>
            </div>
            <div class="grid-body no-border">
                <?php //$this->widget('application.modules.admin.widgets.GetChilds', array('updatedHidden' => 'hidden-id')); ?>
                <label>Категория
                    <select name="category">
                        <?php $this->actionGetCategory(); ?>
                    </select>
                </label>
                <label id="brands" style="display: none"></label>
                <div class="grid-body no-border" style="display: none">
                    <div class="row-fluid">
                        <form method="post" action="/x8/union/view">
                            <table class="table table-bordered no-more-tables table-hover">
                                <thead>
                                    <tr class="">
                                        <th width="1%">
                                            <!--<input type="checkbox" class="checkall" value="1">-->
                                            <label for="checkbox20"></label>
                                        </th>
                                        <th width="12%" class="text-center">ID</th>
                                        <th width="15%" class="text-center">Название</th>                                    
                                        <th width="6%" class="text-center">--</th>
                                    </tr>
                                </thead>
                                <tbody id="models-table">

                                </tbody>
                            </table>
                            <div style="position: fixed;right: 50px;bottom: 50px;z-index: 10000;border:3px solid #0AA699;" class="form-actions">
                                <button name="yt0" type="submit" class="btn btn-primary btn-large">Объединить</button>    
                            </div>
                        </form>                        
                    </div>
                </div>
            </div>
        </div>	
    </div>
</div>

<script>
    $('select[name="category"]').on('change', function() {
        $.get('/x8/union/getBrands', {id: $(this).val()}, function(res) {
            $('#brands').html(res);
            $('select[name="brand"]').css("width", "100%").select2();
            $('#brands').show();
        })
    });

    $('#brands').on('change', 'select[name="brand"]', function() {
        $.get('/x8/union/getModels', {id: $(this).val()}, function(res) {
            $('#models-table').html(res);
            $('.grid-body').show();
        })
    });

</script>